<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title></title>
</head>

<body>
	<script type="text/javascript">
		//编写方法: 统计字符串中出现最多的字母与次数
		var str = "abcdaaaaaaaa";  //输出——最多的字母是a,次数为9
		let str2 = str.split()
		let obj = ((str1) => {
			let arr = str1.map(item => {
				return item.split('')
			})
			console.log(arr);
			let arr2 = arr[0].reduce((pre, cur) => {
				if (cur in pre) {
					pre[cur]++
				} else {
					pre[cur] = 1
				}
				return pre
			}, {})
			console.log(arr2);
		})
		obj(str2)

	</script>
</body>

</html>